<?php

namespace app\api\validate;

use think\Validate;

class Register extends Validate
{
    /**
     * 验证规则
     */
    protected $rule = [
        'real_name' => 'require',
        'mobile' => 'require|unique:user',
        'idcard' => 'require|max:18',
        'password' => 'require|max:12|min:6|alphaNum',
        'pay_password' => 'require|max:12|min:6|alphaNum',
        'code' => 'require',
        'nickname' => 'require',


    ];
    /**
     * 提示消息
     */
    protected $message = [
        'real_name.require' => '请输入您的姓名！',
        'mobile.require' => '请输入您的手机号！',
        'mobile.unique' => '该手机号已经注册！',
        'idcard.require' => '请输入您的身份证号！',
        'idcard.max' => '身份证号不能超过18位',
        'password.max' => '密码不能超过12位',
        'password.min' => '密码不能少于6位',
        'password.require' => '密码不能为空',
        'password.alphaNum' => '密码只能有字母、数字组成',
        'pay_password.max' => '交易密码不能超过12位',
        'pay_password.min' => '交易密码不能少于6位',
        'pay_password.require' => '交易密码不能为空',
        'pay_password.alphaNum' => '交易密码只能有字母、数字组成',
        'code.require' => '请输入验证码',
        'nickname.require' => '昵称不能为空',

    ];
    /**
     * 验证场景
     */
    protected $scene = [
        'save' => ['real_name', 'mobile', 'idcard'],
        'update' => ['real_name', 'idcard'],
        'reg' => ['password', 'mobile', 'code','nickname','pay_password']
    ];

}
